#include <iostream>
using namespace std;

template<typename T>
T gcd(T a, T b) {
	return b == 0 ? a : gcd(b, a%b);
}

int main() {
	int a, b;
	while (cin >> a >> b) {
		cout << gcd(a, b) << endl;
	}
	return 0;
}

